<template>
  <div>
    <div class="page-title">HSE待审核的问题</div>
    <div class="page-content">
      <!-- 查询输入框，按钮 -->
      <el-form
        :inline="true"
        :model="filterQuery"
      >
          <el-form-item label="检查单位">
            <treeselect
              :multiple="false"
              :options="options"
              placeholder="请选择检查单位"
              v-model="filterQuery.companyCode"
              style="width: 220px"
            />
          </el-form-item>
          <el-form-item label="检查日期">
              <el-date-picker
                type="date"
                placeholder="选择日期"
                v-model="filterQuery.startDate"
                value-format="yyyy-MM-dd"
                style="width: 200px"
              ></el-date-picker>
              <span>-</span>
              <el-date-picker
                v-model="filterQuery.endDate"
                type="date"
                placeholder="选择日期"
                value-format="yyyy-MM-dd"
                style="width: 200px"
              ></el-date-picker>
            </el-form-item>
          <el-form-item>
            <el-button
              type="primary"
              @click="handleGetPersonNeedExamine"
              icon="el-icon-search"
              >查询</el-button
            >
          </el-form-item>
          <!-- <el-form-item>
            <el-button
              type="primary"
              @click="export2Excel()"
              style="width: 100%"
              >导出Excel</el-button
            >
          </el-form-item> -->
          <el-form-item>
            <el-button type="primary" @click="quickCheck">一键审核</el-button>
          </el-form-item>
      </el-form>

      <!-- 问题列表table -->
      <el-table
        :data="tableData"
        border
        ref="refTable"
        style="width: 100%"
        @selection-change="handleSelectionChange"
        >>
        <!-- 问题列表，显示在table里面的内容 -->
        <el-table-column type="selection" width="55"></el-table-column>
        <el-table-column
          type="index"
          :index="this.indexStartNum"
          label="序号"
          width="50"
        ></el-table-column>
        <el-table-column
          label="检查时间"
          prop="audittime"
          header-align="center"
        >
        </el-table-column>
        <el-table-column
          label="机关处室/二级单位"
          prop="parentCompanyName"
          header-align="center"
        >
        </el-table-column>
        <el-table-column
          label="科室/基层单位"
          prop="basicCompanyName"
          header-align="center"
        >
        </el-table-column>
        <el-table-column
          label="作业队号(集团和公司队号）"
          prop="operationTeamName"
          header-align="center"
        >
        </el-table-column>
        <el-table-column
          show-overflow-tooltip
          label="问题描述"
          prop="audDescription"
          header-align="center"
        >
        </el-table-column>
        <el-table-column
          label="责任人"
          prop="responsePersonName"
          header-align="center"
        >
        </el-table-column>
        <el-table-column label="分类" prop="classify" header-align="center">
        </el-table-column>
        <el-table-column
          label="操作"
          align="center"
          header-align="center"
          width="250"
        >
          <template slot-scope="scope">
            <el-button
              size="mini"
              type="primary"
              icon="el-icon-edit"
              @click="auditProblem(scope.row)"
              >审核</el-button
            >
            <el-button
              size="mini"
              type="danger"
              icon="el-icon-delete"
              @click="handleDeleteAudit(scope.row.qHSEECheckRecordID)"
              >删除</el-button
            >
          </template>
        </el-table-column>
      </el-table>
      <el-dialog
        :visible.sync="entryDialogVisible"
        title="问题详情"
        style="width: 2000px; height: 800px; left: -20%; top: 0%"
      >
        <div style="height: 50vh; width: 100%; overflow: auto">
          <el-form
            :model="hseAuditProblemForm"
            ref="hseAuditProblemForm"
            :rules="hseAuditProblemFormRules"
            label-width="100px"
            label-position="right"
            style="width: 100%"
          >
            <el-row>
              <el-col :span="12">
                <el-form-item label="组内审核">
                  <el-input
                    v-model="hseAuditProblemForm.internalAuditorName"
                    style="width: 50%"
                    readonly
                  >
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="审核时间">
                  <el-date-picker
                    placeholder="请选择审核时间"
                    v-model="hseAuditProblemForm.audittime"
                    value-format="yyyy-MM-dd"
                    format="yyyy-MM-dd"
                    style="width: 50%"
                    clearable
                  >
                  </el-date-picker>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="受检单位">
                  <el-select
                    placeholder="请选择受检单位"
                    v-model="hseAuditProblemForm.companyName"
                    value-key="companyCode"
                    @change="getCompany"
                    style="width: 50%"
                    clearable
                  >
                    <el-option
                      v-for="item in companyData"
                      :key="item.companyCode"
                      :label="item.companyName"
                      :value="item"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="轮次">
                  <el-input
                    v-model="hseAuditProblemForm.round"
                    style="width: 50%"
                    readonly
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col>
                <el-form-item label="问题描述">
                  <el-input
                    v-model="hseAuditProblemForm.audDescription"
                    type="textarea"
                    style="width: 78%"
                    clearable
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col>
                <el-form-item label="判定依据">
                  <el-input
                    type="textarea"
                    v-model="hseAuditProblemForm.judgmentBasis"
                    style="width: 78%"
                    readonly
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col>
                <el-form-item label="QHSEE管理体系要素">
                  <el-input
                    v-model="hseAuditProblemForm.qHSEEManagementFactor"
                    style="width: 78%"
                    clearable
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="涉及要素">
                  <el-input
                    v-model="hseAuditProblemForm.elementsInvolved"
                    style="width: 50%"
                    clearable
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="审核主题">
                  <el-input
                    v-model="hseAuditProblemForm.auditSubject"
                    style="width: 50%"
                    readonly
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col>
                <el-form-item label="审核项">
                  <el-input
                    v-model="hseAuditProblemForm.auditItem"
                    style="width: 78%"
                    readonly
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col>
                <el-form-item label="审核内容">
                  <el-input
                    v-model="hseAuditProblemForm.auditContent"
                    type="textarea"
                    style="width: 78%"
                    readonly
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="问题级别">
                  <el-select
                    placeholder="请选择问题级别"
                    v-model="hseAuditProblemForm.questionLevel"
                    style="width: 50%"
                    clearable
                  >
                    <el-option
                      v-for="item in problemLevel"
                      :key="item.id"
                      :label="item.name"
                      :value="item.name"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="原因分析">
                  <el-select
                    placeholder="请选择问题原因"
                    v-model="hseAuditProblemForm.causeAnalysis"
                    style="width: 50%"
                    clearable
                  >
                    <el-option
                      v-for="item in problemCause"
                      :key="item.id"
                      :label="item.name"
                      :value="item.name"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="隐患级别">
                  <el-select
                    placeholder="请选择隐患级别"
                    v-model="hseAuditProblemForm.problemLevel"
                    style="width: 50%"
                    clearable
                  >
                    <el-option
                      v-for="item in dangerLevel"
                      :key="item.id"
                      :label="item.name"
                      :value="item.name"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="审核类别">
                  <el-input
                    v-model="hseAuditProblemForm.classify"
                    style="width: 50%"
                    readonly
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col>
                <el-form-item label="整改建议">
                  <el-input
                    v-model="hseAuditProblemForm.rectificationSuggestions"
                    type="textarea"
                    style="width: 78%"
                    clearable
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="责任人">
                  <el-select
                    placeholder="输入姓名搜索"
                    v-model="hseAuditProblemForm.responsePersonName"
                    value-key="employeeID"
                    @change="getresponsePerson"
                    style="width: 50%"
                    filterable
                    clearable
                  >
                    <el-option
                      v-for="item in employees"
                      :key="item.employeeID"
                      :label="item.name"
                      :value="item"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="整改责任人">
                  <el-select
                    placeholder="输入名字搜索"
                    v-model="hseAuditProblemForm.rectPersonName"
                    value-key="employeeID"
                    @change="getRectPerson"
                    style="width: 50%"
                    filterable
                    clearable
                  >
                    <el-option
                      v-for="item in employees"
                      :key="item.employeeID"
                      :label="item.name"
                      :value="item"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="扣分">
                  <el-input
                    placeholder="请输入分数"
                    v-model="hseAuditProblemForm.lostScore"
                    style="width: 50%"
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="检查图片1： ">
                  <el-card
                    :body-style="{ padding: '10px' }"
                    style="height: 251px; width: 90%"
                  >
                    <el-upload
                      action="/api/file_upload"
                      :on-success="handleSuccessCheckAttach1"
                      :on-remove="handleRemoveCheckAttach"
                      class="avatar-uploader"
                      :show-file-list="false"
                    >
                      <img
                        v-if="hseAuditProblemForm.checkAttach1"
                        :src="hseAuditProblemForm.checkAttach1"
                        class="avatar"
                      />
                      <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                    </el-upload>
                  </el-card>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="检查图片2：">
                  <el-card
                    :body-style="{ padding: '10px' }"
                    style="height: 251px; width: 90%"
                  >
                    <el-upload
                      action="/api/file_upload"
                      :on-success="handleSuccessCheckAttach2"
                      :on-remove="handleRemoveCheckAttach"
                      class="avatar-uploader"
                      :show-file-list="false"
                    >
                      <img
                        v-if="hseAuditProblemForm.checkAttach2"
                        :src="hseAuditProblemForm.checkAttach2"
                        class="avatar"
                      />
                      <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                    </el-upload>
                  </el-card>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="检查图片3：">
                  <el-card
                    :body-style="{ padding: '10px' }"
                    style="height: 251px; width: 90%"
                  >
                    <el-upload
                      action="/api/file_upload"
                      :on-success="handleSuccessCheckAttach3"
                      :on-remove="handleRemoveCheckAttach"
                      class="avatar-uploader"
                      :show-file-list="false"
                    >
                      <img
                        v-if="hseAuditProblemForm.checkAttach3"
                        :src="hseAuditProblemForm.checkAttach3"
                        class="avatar"
                      />
                      <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                    </el-upload>
                  </el-card>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="检查图片4：">
                  <el-card
                    :body-style="{ padding: '10px' }"
                    style="height: 251px; width: 90%"
                  >
                    <el-upload
                      action="/api/file_upload"
                      :on-success="handleSuccessCheckAttach4"
                      :on-remove="handleRemoveCheckAttach"
                      class="avatar-uploader"
                      :show-file-list="false"
                    >
                      <img
                        v-if="hseAuditProblemForm.checkAttach4"
                        :src="hseAuditProblemForm.checkAttach4"
                        class="avatar"
                      />
                      <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                    </el-upload>
                  </el-card>
                </el-form-item>
              </el-col>
            </el-row>
            <el-col>
              <el-form-item label="问题视频">
                <el-card
                  :body-style="{ padding: '10px' }"
                  style="height: 251px; width: 90%"
                >
                  <el-upload
                    class="avatar-uploader"
                    :show-file-list="false"
                    v-model="hseAuditProblemForm.checkVideo"
                    :action="`/api/file_upload`"
                    :auto-upload="true"
                    :limit="1"
                    accept=".mp4, .qlv, .qsv, .ogg, .flv, .avi, .wmv, .rmvb"
                    list-type="text"
                    :on-remove="handleRemoveCheckVideo"
                    :on-success="handleSuccessCheckVideo"
                  >
                    <video
                      v-if="hseAuditProblemForm.checkVideo"
                      :src="hseAuditProblemForm.checkVideo"
                      class="avatar"
                    ></video>
                  </el-upload>
                </el-card>
              </el-form-item>
            </el-col>
          </el-form>
        </div>
        <span slot="footer">
          <el-button @click="entryDialogVisible = false">取 消</el-button>
          <el-button
            type="primary"
            @click="auditSucceedPerson('hseAuditProblemForm')"
            >审核通过</el-button
          >
        </span>
      </el-dialog>
      <el-dialog title="提示" :visible.sync="dialogVisible" width="30%">
        <span>此操作将永久删除该条记录, 是否继续?</span>
        <span slot="footer" class="dialog-footer">
          <el-button @click="dialogVisible = false">取 消</el-button>
          <el-button type="primary" @click="submitDelet">确 定</el-button>
        </span>
      </el-dialog>
      <div class="pagination-base">
        <el-pagination
          @current-change="handlePageChange"
          :current-page="filterQuery.num"
          :page-size="filterQuery.size"
          :total="total"
          background
          layout="total, prev, pager, next, jumper"
        >
        </el-pagination>
      </div>
    </div>
    <!-- <service-dialog
      :show.sync="showDialog"
      :add-data="dataToDialog"
      @cancelDialog="cancelDialog"
      @submitDialog="submitDialog"
    ></service-dialog> -->
  </div>
</template>

<script>
// import { PostquickCheck } from "../../../services/quickCheck";
import { GetDictionary } from "../../../services/dictionary";
import { GetHSEAuditGroupMember } from "../../../services/hseAudit";
import {
  // GetHsePersonNeedExamine,
  // GetHseUpdateRecordStatus,
  DeleteAudit,
} from "../../../services/hseProblemAudit";
import { GetCQCompany } from "../../../services/gettreedata";
import Vue from "vue";
import VueCookies from "vue-cookies";

import { 
GetQHSEECheckRecordByHeadman, 
UpdateCheckRecordByHeadman,
UpdateAllRecordStatusByHeader,
} from "../../../services/hseLeader";


Vue.use(VueCookies);

export default {
  data() {
    return {
      dialogImageUrl: "",
      dialogVisible: false,
      checkAttachFileList: [],
      hseAuditProblemForm: {
        auditContent: "",
        qHSEECheckRecordID: "",
        internalAuditorID: "",
        internalAuditorName: "",
        audittime: "",
        companyCode: "",
        companyName: "",
        round: "",
        audDescription: "",
        judgmentBasis: "",
        qHSEEManagementFactor: "",
        elementsInvolved: "",
        auditSubject: "",
        auditItem: "",
        questionLevel: "",
        causeAnalysis: "",
        dialogVisible: false,
        problemLevel: "",
        classify: "",
        rectificationSuggestions: "",
        lostScore: "",
        responsePersonID: "",
        responsePersonName: "",
        rectPersonID: "",
        rectPersonName: "",
        checkAttach1: "",
        checkAttach2: "",
        checkAttach3: "",
        checkAttach4: "",
        checkVideo: "",
        scoringItem: "",
      },
      hseAuditProblemFormRules: {
        internalAuditorName: [
          { required: true, message: "请选择组内审核人", trigger: "change" },
        ],
      },
      formLabelWidth: "120px",
      // showDialog: false,
      entryDialogVisible: false,
      // dataToDialog: {},
      indexStartNum: 1,
      client: VueCookies.get("client"),
      options: [], //选择单位
      audit: {},
      filterQuery: {
        startDate: "",
        endDate: "",
        companyCode: null,
        num: 0,
        size: 10,
      },
      filterQueryExcel: {},
      fitertask: {},
      total: 0,
      employees: [],
      tableData: [],
      problemAyy: "",
      timeout: null,
      excelData: [],
      levelData: [],
      problemCause: [],
      companyData: [],
      dangerLevel: [],
      problemLevel: [],
      checkType: [],
      multipleSelection: [],
      qHSEECheckRecordIDs: [],
    };
  },

  mounted() {
    this.getDate(); // 获取公司列表
    this.handleGetPersonNeedExamine(); //获取全部待审核
  },

  methods: {
    //一键审核
    quickCheck() {
      this.qHSEECheckRecordIDs=[]
      for (let item in this.multipleSelection) {
        this.qHSEECheckRecordIDs[item] = this.multipleSelection[item].qHSEECheckRecordID;
      }
      console.log(11, this.qHSEECheckRecordIDs);
      UpdateAllRecordStatusByHeader({ qHSEECheckRecordIDs: this.qHSEECheckRecordIDs })
        .then((res) => {
          if (res.code == 1000) {
            this.$message.success("一键审核成功!");
            this.$router.go(0);
          }
        })
      .catch((e) => {
        console.log(e);
        // this.$message.error("一键审核失败！");
      });
    },
    //多选框发生变化
    handleSelectionChange(val) {
      this.multipleSelection = val;
      console.log(2222,this.multipleSelection);
    },
    // 二次确认删除
    submitDelet() {
      this.dialogVisible = false;
      this.deleteAudit();
    },
    // 删除
    handleDeleteAudit(qHSEECheckRecordID) {
      this.qHSEECheckRecordID = qHSEECheckRecordID;
      this.dialogVisible = true;
      this.handleGetPersonNeedExamine();
    },
    // 网络请求删除数据
    deleteAudit() {
      DeleteAudit({ qHSEECheckRecordID: this.qHSEECheckRecordID })
        .then((res) => {
          console.log(8, res);
          this.$message.success("删除成功");
          this.handleGetPersonNeedExamine(this.hseAuditProblemForm);
          console.log("s", res);
        })
        .catch((e) => {
          console.log(e);
          this.$message.error("删除失败");
        });
    },
    // 审核
    auditProblem(row) {
      console.log(0, row);
      const {
        qHSEECheckRecordID,
        internalAuditorID,
        internalAuditorName,
        audittime,
        companyCode,
        companyName,
        round,
        audDescription,
        judgmentBasis,
        qHSEEManagementFactor,
        elementsInvolved,
        auditSubject,
        auditItem,
        questionLevel,
        causeAnalysis,
        problemLevel,
        classify,
        rectificationSuggestions,
        responsePersonName,
        rectPersonName,
        lostScore,
        responsePersonID,
        rectPersonID,
        checkAttach1,
        checkAttach2,
        checkAttach3,
        checkAttach4,
        checkVideo,
        auditContent,
      } = row;
      this.hseAuditProblemForm = Object.assign({}, this.hseAuditProblemForm, {
        qHSEECheckRecordID,
        auditContent,
        internalAuditorID,
        internalAuditorName,
        audittime,
        companyCode,
        companyName,
        round,
        audDescription,
        judgmentBasis,
        responsePersonName,
        qHSEEManagementFactor,
        elementsInvolved,
        auditSubject,
        auditItem,
        questionLevel,
        rectPersonName,
        causeAnalysis,
        problemLevel,
        classify,
        rectificationSuggestions,
        lostScore,
        responsePersonID,
        rectPersonID,
        checkAttach1,
        checkAttach2,
        checkAttach3,
        checkAttach4,
        checkVideo,
      });
      console.log(this.hseAuditProblemForm);
      this.entryDialogVisible = true;
      GetDictionary({ name: "检查类型" })
        .then((res) => {
          this.checkType = res.data;
        })
        .catch((err) => {
          this.$message.error(err);
        });
      GetDictionary({ name: "QHSEE问题级别" })
        .then((res) => {
          this.problemLevel = res.data;
        })
        .catch((err) => {
          this.$message.error(err);
        });
      GetDictionary({ name: "QHSEE隐患级别" })
        .then((res) => {
          this.dangerLevel = res.data;
        })
        .catch((err) => {
          this.$message.error(err);
        });
      GetDictionary({ name: "问题原因" })
        .then((res) => {
          this.problemCause = res.data;
        })
        .catch((err) => {
          this.$message.error(err);
        });
      GetHSEAuditGroupMember()
        .then((res) => {
          this.employees = res.data;
        })
        .catch((err) => {
          this.$message.error(err);
        });
      this.hseAuditProblemForm.judgmentBasis = row.judgmentBasis;
      this.hseAuditProblemForm.scoringItem = row.evalueItem;
    },
    auditSucceedPerson(audit) {
      console.log(11, audit);
      console.log("u", this.$refs[audit]);
      this.$refs[audit].validate((valid) => {
        if (valid) {
          console.log(2, this.hseAuditProblemForm);
          UpdateCheckRecordByHeadman(this.hseAuditProblemForm).then(
            () => {
              console.log(9, valid);
              this.entryDialogVisible = false;
              this.$message.success("操作成功");
              this.$refs[audit].resetFields();
              this.handleGetPersonNeedExamine();
            },
            (err) => {
              this.$message.error(err.message);
            }
          );
        } else {
          this.$notify.warning({
            title: "温馨提示",
            message: "请检查必填项",
          });
          return false;
        }
      });
    },
    getCompany(value) {
      this.hseAuditProblemForm.companyCode = value.companyCode;
      this.hseAuditProblemForm.companyName = value.companyName;
    },
    getresponsePerson(value) {
      this.hseAuditProblemForm.responsePersonID = value.employeeID;
      this.hseAuditProblemForm.responsePersonName = value.name;
    },
    getRectPerson(value) {
      this.hseAuditProblemForm.rectPersonID = value.employeeID;
      this.hseAuditProblemForm.rectPersonName = value.name;
    },
    handlePictureCardPreview(file) {
      this.dialogImageUrl = file.url;
      this.dialogVisible = true;
    },
    handleRemoveCheckAttach(file, fileList) {
      this.checkAttachFileList = fileList;
    },
    handleSuccessCheckAttach1(response, file, fileList) {
      let imgUrl = "http://39.98.173.131:8080/resources/";
      console.log(response, file, fileList);
      if (response) {
        imgUrl += response.data;
        this.$notify.success({
          body: {
            style: { width: "300px", height: "500px" },
          },
          title: "提示",
          message: "文件上传成功",
        });
      }
      this.hseAuditProblemForm.checkAttach1 = imgUrl;
      this.checkAttachFileList = fileList;
    },
    handleSuccessCheckAttach2(response, file, fileList) {
      let imgUrl = "http://39.98.173.131:8080/resources/";
      console.log(response, file, fileList);
      if (response) {
        imgUrl += response.data;
        this.$notify.success({
          body: {
            style: { width: "300px", height: "500px" },
          },
          title: "提示",
          message: "文件上传成功",
        });
      }
      this.hseAuditProblemForm.checkAttach2 = imgUrl;
      this.checkAttachFileList = fileList;
    },
    handleSuccessCheckAttach3(response, file, fileList) {
      let imgUrl = "http://39.98.173.131:8080/resources/";
      console.log(response, file, fileList);
      if (response) {
        imgUrl += response.data;
        this.$notify.success({
          body: {
            style: { width: "300px", height: "500px" },
          },
          title: "提示",
          message: "文件上传成功",
        });
      }
      this.hseAuditProblemForm.checkAttach3 = imgUrl;
      this.checkAttachFileList = fileList;
    },
    handleSuccessCheckAttach4(response, file, fileList) {
      let imgUrl = "http://39.98.173.131:8080/resources/";
      console.log(response, file, fileList);
      if (response) {
        imgUrl += response.data;
        this.$notify.success({
          body: {
            style: { width: "300px", height: "500px" },
          },
          title: "提示",
          message: "文件上传成功",
        });
      }
      this.hseAuditProblemForm.checkAttach4 = imgUrl;
      this.checkAttachFileList = fileList;
    },
    handleRemoveCheckVideo() {
      this.hseAuditProblemForm.checkVideo = "";
      this.checkVideourl = "";
    },
    beforeAttachUpload(file) {
      let size = file.size / 1024 / 1024 / 12;
      if (size > 1) {
        this.$message.error("上传文件大小不能超过12MB！");
      }
    },
    // 上传视频
    handleSuccessCheckVideo(response, file) {
      let videoUrl = "http://39.98.173.131:8080/resources/";
      if (response) {
        videoUrl += response.data;
        this.$notify.success({
          body: {
            style: { width: "300px", height: "500px" },
          },
          title: "提示",
          message: "问题视频上传成功",
        });
        this.hseAuditProblemForm.checkVideo = response.data;
        this.hseAuditProblemForm.checkVideo = videoUrl;
        this.checkVideourl = URL.createObjectURL(file.raw);
      }
    },
    //   查询
    handleGetPersonNeedExamine() {
      if(this.filterQuery.startDate == null) {
        this.filterQuery.startDate = ""
      }
      if(this.filterQuery.endDate == null) {
        this.filterQuery.endDate = ""
      }
      GetQHSEECheckRecordByHeadman(this.filterQuery).then((res) => {
        console.log("e", res.data);
        this.indexStartNum =
          this.filterQuery.num * this.filterQuery.size + 1;
        this.tableData = res.data.list;
        this.total = res.data.total;
      });
    },
    //获取公司
    getDate() {
      GetCQCompany()
        .then((res) => {
          this.options = res.data;
        })
        .catch((err) => {
          this.$message.error(err.message);
        });
    },

    // cancelDialog(val) {
    //   this.dataToDialog = {};
    //   this.showDialog = val;
    // },
    // submitDialog(val) {
    //   this.dataToDialog = {};
    //   this.showDialog = val;
    // },
    //页码改变
    handlePageChange(page) {
      this.filterQuery.num = page;
      this.handleGetPersonNeedExamine();
    },
  },
};
</script>
<style media="screen">
.el-table th {
    display: table-cell ! important;
}

.avatar {
  width: 100%;
  height: 100%;
}
.demo-table-expand {
  font-size: 0;
}
.demo-table-expand label {
  /* width: 49%; */
  color: #99a9bf;
}
.demo-table-expand .el-form-item {
  margin-right: 0;
  margin-bottom: 0;
  /* width: 49%; */
}
/*分辨率低于1280，采用下面的样式*/
@media screen and (max-device-width: 1280px) {
  .outDiv {
    width: 1060px;
  }
}
/*分辨率高于1280，采用下面的样式*/
@media screen and (min-device-width: 1281px) {
  .outDiv {
    width: 100%;
  }
}
</style>
